Vscode Java 环境配置

五月 04, 2020

准备工作

以上较为普通,随便网上搜下安装包,配置下环境变量即可

VSCode 插件安装

1、Language Support for Java(TM) by Red Hat
2、Java Test Runner
3、Debugger for Java
4、Maven for Java
5、Java Extension Pack

配置vscode mvn源

1、修改Vscode插件Maven for Java默认使用的mvn路径

Maven for Java1

Maven for Java2

2、修改mvn的镜像源,mvn安装目录下找到conf/setting.xml文件,新增

<mirrors>
    <!-- mirror
    | Specifies a repository mirror site to use instead of a given repository. The repository that
    | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
    | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
    |
    <mirror>
        <id>mirrorId</id>
        <mirrorOf>repositoryId</mirrorOf>
        <name>Human Readable Name for this Mirror.</name>
        <url>http://my.repository.com/repo/path</url>
    </mirror>
        -->
    <mirror>
        <id>nexus</id>
        <mirrorOf>*</mirrorOf>
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    </mirror>
    <mirror>
        <id>nexus-public-snapshots</id>
        <mirrorOf>public-snapshots</mirrorOf>
        <url>http://maven.aliyun.com/nexus/content/repositories/snapshots/</url>
    </mirror>
</mirrors>

Maven for Java3

测试运行

使用mvn创建项目, 可以从模板创建:
Maven for Java4

完成